<!DOCTYPE html>
<!-- ng-app -->
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../../../js/plugins/angular/angular.min.js" type="text/javascript"></script>
</head>
<body>
    <div ng-controller="cont">
        <div>姓名：{{name}}</div>
        <div>邮件：{{email}}</div>
        <div>{{title}}</div>
        <button ng-click="say()">主题</button>
    </div>

    <script>
        angular.module('app',[])
            .service('$student',function () {
                this.name = "hjy";
                this.email = "hjy.com";
                this.say = function () {
                    return "hello";
                }
            })
            .controller('cont',function ($scope,$student) {
                $scope.name = $student.name;
                $scope.email = $student.email;
                $scope.say = function () {
                    $scope.title = $student.say();
                }
            })

    </script>
</body>
</html>